package com.hnhegui.backend.system.controller;

import com.hnhegui.backend.entity.PageResult;
import com.hnhegui.backend.entity.Result;
import com.hnhegui.backend.system.api.UserRestApi;
import com.hnhegui.backend.system.dto.request.UserQueryRequestDTO;
import com.hnhegui.backend.system.dto.response.UserResponseDTO;
import com.hnhegui.backend.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user")
public class UserController implements UserRestApi {

    @Autowired
    private UserService userService;

    @Override
    public Result<PageResult<UserResponseDTO>> queryUsers(UserQueryRequestDTO request) {
        PageResult<UserResponseDTO> pageResult = userService.queryUsers(request);
        return Result.success(pageResult);
    }
}
